package com.sphd.emanu.adapter;

import android.widget.EditText;
import android.widget.LinearLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.emanu.R;
import com.sphd.emanu.pojo.goods.Composition;

import java.util.List;

/**
 * @Author Hu
 * @Time 2017/5/3 --17:46.
 * @Email 87683202@qq.com
 */
public class GoodsfromAdapter extends BaseQuickAdapter<Composition,BaseViewHolder> {
    boolean isEdit=false;
    public GoodsfromAdapter(int layoutResId, List<Composition> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Composition item) {
       helper.setVisible(R.id.item_edit_del,isEdit).addOnClickListener(R.id.item_edit).addOnClickListener(R.id.item_del)

       .setText(R.id.item_name,item.getName())
       .setText(R.id.item_specifications,item.getSpecifications())
       .setText(R.id.item_category,item.getModel());

        EditText editText =helper.getView(R.id.item_edit_amount);
        editText.setText(item.getAmount()+"");
        editText.setEnabled(false);

//               .setVisible(R.id.item_edit_name,false)
//               .setVisible(R.id.item_edit_specifications,false)
//               .setVisible(R.id.item_edit_amount,false)
//               .setVisible(R.id.item_edit_category,false);
    }

    public void setEdit(boolean edit) {
        isEdit = edit;
    }
}
